<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php $this->load->view('common/head'); ?>

<?php $this->load->view('common/header'); ?>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <?php $this->load->view('common/sidebar'); ?>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <?php $this->load->view('common/breadcrumbs'); ?>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">

                <?php $this->load->view('common/set'); ?>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <form id="export-form" method="post" action="<?php echo site_url(X_URL . 'group/del'); ?>">
                            <table class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                    <th>用户组ID</th>
                                    <th>用户组</th>
                                    <th>状态</th>
                                    <th class="center">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                if (isset($groups)) {
                                    foreach ($groups as $key => $value) {
                                        ?>
                                        <tr>
                                            <td class="center">
                                                <?php if ($value['id'] != 1) : ?>
                                                    <input class="ids" type="checkbox" name="ids[]"
                                                           value="{$val['id']}">
                                                <?php else : ?>
                                                    <span title="系统用户组，禁止删除">--</span>
                                                <?php endif; ?>
                                            </td>
                                            <td><?php echo $value["id"]; ?></td>
                                            <td><?php echo $value["title"]; ?></td>
                                            <td>
                                                <?php if ($value['id'] == 1) : ?> 已启用
                                                <?php elseif ($value['status'] == 1) : ?>
                                                    已启用 | <a
                                                            href="<?php echo site_url(X_URL . 'group/status/' . $value['id']); ?>"
                                                            title="点击禁用">点击禁用</a>
                                                <?php else : ?>
                                                    已禁用 | <a
                                                            href="<?php echo site_url(X_URL . 'group/status/' . $value['id']); ?>"
                                                            title="点击启用">点击启用</a>
                                                <?php endif; ?>
                                            </td>
                                            <td class="center"><a
                                                        href="<?php echo site_url(X_URL . 'group/edit/' . $value['id']); ?>">修改</a>
                                            </td>
                                        </tr>
                                    <?php } ?>
                                <?php } ?>
                                </tbody>
                            </table>
                            <div class="cf">
                                <input class="btn btn-info" type="submit" value="删除">
                            </div>
                        </form>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <?php $this->load->view('common/footer'); ?>
</div>


<?php $this->load->view('common/footerjs'); ?>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    (function ($) {
        $(".check-all").click(function () {
            $(".ids").prop("checked", this.checked);
        });
        $(".ids").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
    })(jQuery);
</script>
</body>
</html>
